home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / pgm_util / callli / calllist.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-10-17  |  44.6 KB  |  1,187 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   6525
  5.    ClientLeft      =   165
  6.    ClientTop       =   690
  7.    ClientWidth     =   9435
  8.    Height          =   7365
  9.    Left            =   30
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   435
  12.    ScaleMode       =   3  'Pixel
  13.    ScaleWidth      =   629
  14.    Top             =   -15
  15.    Width           =   9705
  16.    WindowState     =   2  'Maximized
  17.    Begin ListBox listmodulenames 
  18.       DragIcon        =   CALLLIST.FRX:0000
  19.       Height          =   3930
  20.       Left            =   6540
  21.       Sorted          =   -1  'True
  22.       TabIndex        =   11
  23.       Top             =   300
  24.       Width           =   2415
  25.    End
  26.    Begin PictureBox picarrowdn 
  27.       AutoRedraw      =   -1  'True
  28.       AutoSize        =   -1  'True
  29.       Height          =   255
  30.       Left            =   5880
  31.       Picture         =   CALLLIST.FRX:0302
  32.       ScaleHeight     =   15
  33.       ScaleMode       =   3  'Pixel
  34.       ScaleWidth      =   20
  35.       TabIndex        =   10
  36.       Top             =   6240
  37.       Visible         =   0   'False
  38.       Width           =   330
  39.    End
  40.    Begin PictureBox picarrowup 
  41.       AutoRedraw      =   -1  'True
  42.       AutoSize        =   -1  'True
  43.       Height          =   255
  44.       Left            =   6000
  45.       Picture         =   CALLLIST.FRX:0868
  46.       ScaleHeight     =   225
  47.       ScaleWidth      =   300
  48.       TabIndex        =   9
  49.       Top             =   5820
  50.       Visible         =   0   'False
  51.       Width           =   330
  52.    End
  53.    Begin CheckBox Check1 
  54.       Caption         =   "Locked"
  55.       Height          =   495
  56.       Index           =   0
  57.       Left            =   4800
  58.       TabIndex        =   8
  59.       Top             =   300
  60.       Width           =   975
  61.    End
  62.    Begin CommonDialog CMDialog1 
  63.       Filter          =   "Forms (*.FRM)|*.frm|Modules (*.BAS)|*.bas"
  64.       InitDir         =   "c:\vb\erase"
  65.       Left            =   6360
  66.       Top             =   6120
  67.    End
  68.    Begin PictureBox Picture1 
  69.       Height          =   5775
  70.       Left            =   480
  71.       ScaleHeight     =   5745
  72.       ScaleWidth      =   6465
  73.       TabIndex        =   4
  74.       Top             =   120
  75.       Visible         =   0   'False
  76.       Width           =   6495
  77.       Begin CommandButton btnclose 
  78.          Caption         =   "Close"
  79.          Height          =   555
  80.          Left            =   4980
  81.          TabIndex        =   15
  82.          Top             =   4680
  83.          Width           =   1335
  84.       End
  85.       Begin TextBox Text1 
  86.          Height          =   4335
  87.          Left            =   120
  88.          MultiLine       =   -1  'True
  89.          ScrollBars      =   2  'Vertical
  90.          TabIndex        =   14
  91.          Text            =   "Text1"
  92.          Top             =   1260
  93.          Width           =   4455
  94.       End
  95.       Begin CommandButton Command3 
  96.          Caption         =   "Close"
  97.          Height          =   495
  98.          Left            =   8400
  99.          TabIndex        =   7
  100.          Top             =   5760
  101.          Width           =   855
  102.       End
  103.       Begin Label Label8 
  104.          Caption         =   "If you have comments, or if you found a bug, or if you have an idea for a feature to add, please contact me on CompuServe, 71630,1265."
  105.          Height          =   615
  106.          Left            =   60
  107.          TabIndex        =   6
  108.          Top             =   420
  109.          Width           =   4635
  110.       End
  111.       Begin Label Label7 
  112.          Caption         =   "Programmed by Steve Denenberg"
  113.          Height          =   315
  114.          Left            =   120
  115.          TabIndex        =   5
  116.          Top             =   0
  117.          Width           =   3075
  118.       End
  119.    End
  120.    Begin ListBox list1 
  121.       Height          =   1005
  122.       Index           =   0
  123.       Left            =   60
  124.       TabIndex        =   0
  125.       Top             =   120
  126.       Width           =   4335
  127.    End
  128.    Begin Label Label5 
  129.       Height          =   315
  130.       Left            =   7740
  131.       TabIndex        =   3
  132.       Top             =   4560
  133.       Width           =   1635
  134.    End
  135.    Begin Label Label4 
  136.       Caption         =   "Inputting:"
  137.       Height          =   255
  138.       Left            =   6720
  139.       TabIndex        =   13
  140.       Top             =   4560
  141.       Width           =   855
  142.    End
  143.    Begin Label Label3 
  144.       Caption         =   "Module Names"
  145.       Height          =   315
  146.       Left            =   6780
  147.       TabIndex        =   12
  148.       Top             =   0
  149.       Width           =   1395
  150.    End
  151.    Begin Label Label2 
  152.       Caption         =   "Lines read:"
  153.       Height          =   255
  154.       Left            =   6660
  155.       TabIndex        =   2
  156.       Top             =   4980
  157.       Width           =   975
  158.    End
  159.    Begin Label Label1 
  160.       Caption         =   "0"
  161.       Height          =   315
  162.       Left            =   7740
  163.       TabIndex        =   1
  164.       Top             =   4980
  165.       Width           =   855
  166.    End
  167.    Begin Menu zzfileitem 
  168.       Caption         =   "&File"
  169.       Begin Menu openfileitem 
  170.          Caption         =   "&Open"
  171.       End
  172.       Begin Menu zzsep 
  173.          Caption         =   "-"
  174.       End
  175.       Begin Menu exititem 
  176.          Caption         =   "E&xit"
  177.       End
  178.    End
  179.    Begin Menu zzmoveboxesitem 
  180.       Caption         =   "&Move boxes"
  181.       Begin Menu moveboxesupitem 
  182.          Caption         =   "&Up"
  183.       End
  184.       Begin Menu moveboxesdownitem 
  185.          Caption         =   "&Down"
  186.       End
  187.    End
  188.    Begin Menu zzhelpitem 
  189.       Caption         =   "&Help"
  190.       Begin Menu howtousesubfinderitem 
  191.          Caption         =   "How to Use Sub Finder"
  192.       End
  193.    End
  194. Option Explicit
  195. Dim dontrecurse As Integer
  196. Dim maxlength1 As Integer
  197. Const maxlistboxindex = 4
  198. Dim maxlength2  As Integer
  199. Dim totalnumberofsubs As Integer
  200. Dim dontrecurse2 As Integer
  201. Option Compare Text
  202. Dim modulereference(700, 25) As Integer
  203. Dim modulename(100) As String
  204. Dim lineoftext(200) As String
  205. Dim fileend As Integer
  206. Dim thiscallsallofthese(4) As Integer
  207. Dim filetoopen As String
  208. Dim bodyindex As Integer
  209. Const locked = 1
  210. 'first parameter is the sub or function number
  211. 'second parameter lists the subs that are called within the sub
  212. '  indexed in the first parameter
  213. 'each listbox has an associated flag, thiscallsallofthese(), which
  214. '  tells whether the label between that list box and the list box
  215. '  BELOW it is thiscalls all of these, or all of these call this
  216. Dim sublist(10, 10, 10) As String
  217. 'when a module is loaded into a list box:
  218. '  load into that list box the subs in that module
  219. '  do nothing else at that time
  220. 'when a listbox entry is selected:
  221. '  if the listbox below (deep) to that listbox is not locked, then
  222. '  if there is a selected entry in the deep listbox, save it in a variable
  223. '  enter into the listbox below all of the subs that the selected
  224. '  sub calls.  set thiscallsallof these() to true for the listbox
  225. '  where the sub was selected.
  226. '  if the deep listbox had thiscallsallof these(), then look for a match
  227. '  between the saved variable and the new entries in the deep listbox.
  228. '  If there is a match, select that item.
  229. '  If there is not a match, selecte no item, and clear all the listboxes
  230. '  deep to the deep listbox
  231. '  if the deep listbox has NOT thiscallsallofthese(), select no item in
  232. '  the deep listbox, and clear all the listboxes deep to the deep listbox
  233. '  if the listbox above that listbox is not locked, then
  234. '  if there is a selected item in the superficial listbox, save it in
  235. '  a variable.
  236. '  load into that
  237. '  listbox all the subs that call the sub that was selected.  set
  238. '  thiscallsallofthese() to false for the superficial listbox.
  239. '  look for a match between the saved item and the new contents of the
  240. '  superficial listbox.  If there is a match and superficial^2 has
  241. '  allofthesecallthis(), then highlight the saved item.  Otherwise, clear
  242. '  superficial^2 and all listboxes superficial to superficial^2.
  243. 'when an item in a listbox is selected, if the box deep to that is locked,
  244. '  then
  245. '  if thiscallsallofthese for the selected listbox, give a message that
  246. '  the box below has to be unlocked before a selection can be made in
  247. '  the listbox that was selected.
  248. '  if allofthesecallthis for the selected listbox, then
  249. '  if there is something highlighted in the superficial listbox, save
  250. '  it in a variable.
  251. '  if the box above is unlocked, then load into it all the subs that call
  252. '  the selected sub, and set allofthesecallthis for the superficial listbox.
  253. '  if superficial^2 is thiscallsallofthese, then clear it and all list
  254. '  boxes above it.
  255. '  if superficial^2 is allofthesecallthis, then look for the saved item in
  256. '  superficial^1.  If it is there, highlight it.  If not, clear
  257. '  superficial^2 and everything above it.
  258. '  if the deep box is locked and the superficial box is locked, too, give
  259. '  a message that one of them has to be unlocked first.
  260. 'when an item is selected in a listbox, if the superficial listbox is
  261. '  locked, then
  262. '  if superficial is thiscallsallofthese, deal with the deep boxes.
  263. '  if superficial is allofthesecallthis, then give a message that
  264. '  selection of this item will redo the superficial box.  Ok to proceed?
  265. '  if ok to proceed, then unlock the box and proceed as if the box were
  266. '  unlocked.
  267. Dim doublequote As String * 1
  268. Dim variableindex As Integer
  269. Dim subnumber As Integer
  270. Dim linesread As Integer
  271. Dim z%
  272. Dim cancelread As Integer
  273. Sub btnclose_Click ()
  274. picture1.Visible = False
  275. End Sub
  276. Sub Check1_Click (index As Integer)
  277. If dontrecurse2 Then Exit Sub
  278. 'jjj need a new dontrecurse to move checkboxes.
  279. If list1(index).ListCount = 0 Then
  280.     dontrecurse = True
  281.     check1(index).Value = 0
  282.     dontrecurse = False
  283. End If
  284. End Sub
  285. Sub Command3_Click ()
  286. picture1.Visible = False
  287. End Sub
  288. Sub exititem_Click ()
  289. End Sub
  290. Sub findallsubreferences ()
  291. Dim nextline As String
  292. Dim inasub As Integer
  293. Dim inafunction As Integer
  294. Dim endoffile As Integer
  295. Dim linesread As Long
  296. Dim sublistindex As Integer
  297. Dim maxlength1 As Integer
  298. Dim nextmodule As String
  299. Dim subindex2
  300. Dim holdstring As String
  301. Dim cc As Integer
  302. Dim dd As Integer
  303. Dim instring As Integer
  304. Dim moduleindex As Integer
  305. Dim subnameonly As String
  306. Dim notdonewithsubyet As Integer
  307. Dim wholesubstring As String
  308. Dim xstring As String
  309. moduleindex = 0
  310. 'On Error GoTo goterror3
  311. subnumber = 0
  312. Open filetoopen For Input As #2
  313. Do   'over the different modules
  314. If EOF(2) Then
  315.     'exit if we are done with .MAK
  316.     Close
  317.     GoTo resetandpaint
  318. End If
  319. 'get the next module name
  320. Line Input #2, nextmodule
  321. nextmodule = Trim$(nextmodule)
  322. If Right$(nextmodule, 3) <> "frm" And Right$(nextmodule, 3) <> "bas" Then
  323.     GoTo skipmakentry3
  324. End If
  325. moduleindex = moduleindex + 1
  326. 'start inputting the nextmodule
  327. Open nextmodule For Input As #1
  328. label5.Caption = nextmodule
  329. label5.Refresh
  330. 'linesread starts out zero for each module
  331. linesread = 0
  332. 'preparing to get another sub or function
  333. more3:
  334. 'starting out, subnumber is one
  335. inasub = False
  336. inafunction = False
  337. Do    'inputting the module text
  338. 'if done with this module, then get the next module
  339. If EOF(1) Then
  340.     Close #1
  341.     GoTo gotthefile3
  342. End If
  343. 'look for the sub or function name first
  344. 'if found, advance subnumber, and input the next line
  345. 'lots of lines will be put into one string so that the very large string
  346. '  can be searched all at once, rather than cycling through all of the
  347. '  sub names found for EVERY single line.
  348. Line Input #1, nextline
  349. If Len(nextline) > maxlength1 Then maxlength1 = Len(nextline)
  350. linesread = linesread + 1
  351. If linesread Mod 100 = 0 Then
  352.     label1.Caption = Str$(linesread)
  353.     label1.Refresh
  354. End If
  355. nextline = Trim$(nextline)
  356. If Left$(nextline, 4) = "sub " Then
  357.         inasub = True
  358.         nextline = Right$(nextline, Len(nextline) - 4)
  359.         GoTo initializenewroutine
  360.     ElseIf Left(nextline, 9) = "function " Then
  361.         inafunction = True
  362.         nextline = Right$(nextline, Len(nextline) - 9)
  363.         GoTo initializenewroutine
  364. End If
  365. 'get to here, we have inputted a line that is not the first line
  366. '  of a sub or function.
  367. If (inasub And Left$(nextline, 7) = "end sub") Or (inafunction And Left$(nextline, 12) = "end function") Then
  368.     'we are at the end of the routine, search the big string that
  369.     '  we have been preparing
  370.     GoTo searchwholesub
  371. End If
  372. If (Not inasub) And (Not inafunction) Then
  373.     'just input the next line from the sub
  374.     GoTo skipthisline
  375. End If
  376. 'get to here, the line that we inputted from the module is not
  377. '  the first of a sub, it's not the last, it is in a sub, go to the
  378. '  place that will process it.
  379. GoTo getlinedata
  380. initializenewroutine:
  381. 'make sure the subs input in the same order
  382. Dim thespace As Integer
  383. thespace = InStr(nextline, " ")
  384. If thespace = 0 Then
  385.     MsgBox "sub or function found, but no name can be obtained", 48, "Error"
  386. End If
  387. subnumber = subnumber + 1
  388. sublist2(0, 1) = Trim$(Left$(nextline, thespace - 1)) + "   " + nextmodule
  389. If sublist2(subnumber, 0) <> sublist2(0, 1) Then
  390.     MsgBox "the sub/function names don't count the same as first time through.", 48, "Error"
  391. End If
  392. 'we are starting out a new sub or function.  Subnumber has been
  393. '  updated.  Start over subindex2 and wholesubstring
  394. subindex2 = 0
  395. wholesubstring = ""
  396. 'this goto takes us to inputting the sub or function body after the
  397. '  opening title line of the sub or function.
  398. GoTo getnextline
  399. getlinedata:
  400. 'get sub/function references from nextline
  401. If Left$(nextline, 1) = "'" Then GoTo skipthisline
  402. nextline = stripquotes(nextline)
  403. wholesubstring = wholesubstring + " " + nextline
  404. If Len(wholesubstring) > 30000 Then
  405.         notdonewithsubyet = True
  406.         GoTo searchwholesub
  407.     Else
  408.         'go get the next line
  409.         GoTo skipthisline
  410. End If
  411. searchwholesub:
  412. For cc = 1 To totalnumberofsubs
  413. 'don't test for this very sub name if in a function
  414. If cc = subnumber And inafunction Then GoTo nextcc2
  415. 'strip out the name of the sub only
  416. subnameonly = Left$(sublist2(cc, 0), InStr(sublist2(cc, 0), " "))
  417. 'see if the sub name is in the wholesubstring string
  418. xstring = subnameonly
  419. xstring = Trim$(xstring)
  420. instring = InStr(wholesubstring, xstring)
  421. If instring <> 0 Then
  422.     'make sure the reference is not part of another word
  423.     'make sure the following character isn't part of the same word
  424.     Select Case Mid$(wholesubstring, instring + Len(xstring), 1)
  425.         Case "a" To "z", "A" To "Z", "1" To "9", "0", "_"
  426.             GoTo nextcc2
  427.     End Select
  428.     'make sure the preceeding character isn't part of the same word
  429.     If instring > 1 Then
  430.         Select Case Mid$(wholesubstring, instring - 1, 1)
  431.             Case "a" To "z", "A" To "Z", "1" To "9", "0", "_"
  432.                 GoTo nextcc2
  433.         End Select
  434.     End If
  435.     'if the module name of the sublist2(cc,0) that was found ends in
  436.     '  .frm, then make sure that the module that we are currently
  437.     '  searching is the same .frm
  438.     If Right$(modulename(modulereference(cc, 0)), 3) = "frm" Then
  439.         If modulename(modulereference(cc, 0)) <> nextmodule Then
  440.             GoTo nextcc2
  441.         End If
  442.     End If
  443.     'add this function name to sublist(subnumber,jj)
  444.         For dd = 1 To subindex2 + 1
  445.         If sublist2(subnumber, dd) = sublist2(cc, 0) Then GoTo nextcc2
  446.         Next dd
  447.         subindex2 = subindex2 + 1
  448.         sublist2(subnumber, subindex2) = sublist2(cc, 0)
  449.         modulereference(subnumber, subindex2) = moduleindex
  450.         End If
  451. nextcc2:
  452. Next cc
  453. If notdonewithsubyet = True Then
  454.     notdonewithsubyet = False
  455.     wholesubstring = ""
  456.     GoTo skipthisline
  457. End If
  458. 'go get the next sub
  459. GoTo more3
  460. skipthisline:
  461. getnextline:
  462. Loop      'getting the module text
  463. gotthefile3:
  464. skipmakentry3:
  465. Loop     'inputting the different modules
  466. resetandpaint:
  467. 'clear all check boxes and list boxes
  468. For cc = 0 To maxlistboxindex
  469. check1(cc).Value = 0
  470. list1(cc).Clear
  471. Next cc
  472. 'load listmodulenames
  473. listmodulenames.Clear
  474. cc = 0
  475. cc = cc + 1
  476. If modulename(cc) = "" Then
  477.     Exit Sub
  478. End If
  479. listmodulenames.AddItem modulename(cc)
  480. 'goterror3:
  481. 'MsgBox Error$(Err)
  482. 'Exit Sub
  483. End Sub
  484. Sub Form_Load ()
  485. Caption = "Sub Finder"
  486. Dim cc As Integer
  487. For cc = 1 To 4
  488. Load list1(cc)
  489. Load check1(cc)
  490. Next cc
  491. 'waiting for sub or function start
  492. 'pull in a line
  493. 'if starts with sub or function, that's our first line
  494. '  store it
  495. 'continue pulling in lines until we get to one that
  496. '  says end sub or end function
  497. 'now go through the whole array we pulled in, and look for
  498. '  dim xx
  499. '  redim xx
  500. '  static xx
  501. ' look for "(" or a space, which gives the end of the
  502. '  variable name
  503. '  can also look for commas, and for
  504. '  commas within parentheses
  505. 'that will give us a list of variables to look for
  506. 'now cycle through the array, looking for variables
  507. 'might want to erase the dim statements after grabbing the
  508. '  variables from them
  509. 'pull in a line.  Ignore the line if it starts with an
  510. '  apostrophe.
  511. 'ignore everything between double quotation marks, including
  512. '  apostrophe's
  513. 'ignore everything after an apostrophe
  514. 'make sure the variable, to be ok, starts the line, or is
  515. '  prefaced by a ( or a space, and make sure it is followed
  516. '  by a , or a ) or a space
  517. 'as variables are found, do something to clear them
  518. doublequote = """"
  519. End Sub
  520. Sub form_paint ()
  521. Dim cc As Integer
  522. Dim z%
  523. Dim uparrow As Integer
  524. Dim downarrow As Integer
  525. uparrow = 5
  526. downarrow = list1(0).Left + list1(0).Width - picarrowup.Width
  527. Dim uptext As Integer
  528. uptext = uparrow + picarrowup.Width
  529. For cc = 0 To 3
  530. If list1(cc).ListCount = 0 Then GoTo nextcc02
  531. If list1(cc + 1).ListCount = 0 Then GoTo nextcc02
  532. z% = bitblt(hDC, uparrow, list1(cc).Top + list1(cc).Height + 1, picarrowup.Width, picarrowup.Height, picarrowup.hDC, 0, 0, srccopy)
  533. z% = bitblt(hDC, downarrow, list1(cc + 1).Top - picarrowdn.Height, picarrowdn.Width, picarrowdn.Height, picarrowdn.hDC, 0, 0, srccopy)
  534. If thiscallsallofthese(cc) Then
  535.         currentx = uparrow + picarrowup.Width
  536.         currenty = list1(cc).Top + list1(cc).Height + 4
  537.         Print "THIS highlighted routine";
  538.         'currenty = list1(cc + 1).Top - picarrowdn.Height - 4
  539.         currentx = downarrow - TextWidth("calls ALL of these")
  540.         Print "calls ALL of these"
  541.     Else
  542.         currentx = uparrow + picarrowup.Width
  543.         currenty = list1(cc).Top + list1(cc).Height + 4
  544.         Print "EACH of these";
  545.        ' currenty = list1(cc + 1).Top - picarrowdn.Height - 4
  546.         currentx = downarrow - TextWidth("calls THIS highlighted routine")
  547.         Print "calls THIS highlighted routine"
  548. End If
  549. nextcc02:
  550. Next cc
  551. 'jjj put this in list1().click
  552. 'If listmodulenames.ListCount = 0 Then
  553. End Sub
  554. Sub Form_Resize ()
  555. Dim cc As Integer
  556. Dim tween As Integer
  557. Dim addtotween As Integer
  558. For cc = 0 To maxlistboxindex
  559. list1(cc).Left = 5
  560. list1(cc).Width = 350
  561. check1(cc).Left = list1(cc).Left + list1(cc).Width + 5
  562. Next cc
  563. tween = TextHeight("Tj") + 1.5
  564. list1(0).Height = (scaleheight - tween * (maxlistboxindex)) / (maxlistboxindex + 1)
  565. list1(0).Top = 0
  566. addtotween = (scaleheight - tween * (maxlistboxindex)) / (maxlistboxindex + 1) - list1(0).Height
  567. For cc = 1 To maxlistboxindex
  568. list1(cc).Height = list1(0).Height
  569. '(scaleheight - tween * (maxlistboxindex)) / (maxlistboxindex + 1)
  570. list1(cc).Top = cc * (list1(0).Height + tween + addtotween)
  571. Next cc
  572. For cc = 0 To maxlistboxindex
  573. check1(cc).Top = list1(cc).Top + list1(cc).Height / 2 - check1(cc).Height / 2
  574. Next cc
  575. For cc = 1 To maxlistboxindex
  576. list1(cc).Visible = True
  577. check1(cc).Visible = True
  578. Next cc
  579. End Sub
  580. Sub howtousesubfinderitem_Click ()
  581. Dim crlf As String
  582. crlf = Chr$(13) + Chr$(10) + Chr$(13) + Chr$(10)
  583. Dim x As String
  584. x = x + "This program allows you to select a project file by using a "
  585. x = x + "common dialog box.  All of the forms and modules of the project "
  586. x = x + "will be analyzed for their subroutines and functions.  "
  587. x = x + crlf + "You "
  588. x = x + "will then be able to select any sub or function and see all of the other "
  589. x = x + "subs and functions that are called by the selected sub or function.  "
  590. x = x + "You will also be able to see all of the subs and functions "
  591. x = x + "that CALL the selected sub or function." + crlf + "When you select "
  592. x = x + "File... Open, "
  593. x = x + "and select a project file, the program will analyze the forms and modules.  "
  594. x = x + "As the analysis proceeds, you will be able to see the number of lines that are being read and "
  595. x = x + "the form or module that is currently being analyzed.  The program will "
  596. x = x + "go through all of the forms and modules twice -- once to find the names "
  597. x = x + "of all the subs and functions, and "
  598. x = x + "again to look for the names of the subs and functions in all the "
  599. x = x + "lines of the program." + crlf + "When it is done, the names of the forms and "
  600. x = x + "modules will be loaded into the list box on the right, entitled ''Module"
  601. x = x + "Names.''" + crlf
  602. x = x + "In order to start your analysis, you select one form or module in "
  603. x = x + "the ''Module Names'' listbox, by using your LEFT mouse button.  Then, by "
  604. x = x + "using your RIGHT mouse button, drag the module or form name from the "
  605. x = x + "''Module Names'' list box into one of the five list boxes on the left "
  606. x = x + "side of the form.  That list box will then be loaded with all of the "
  607. x = x + "subs and functions that are in the form or module that you selected.  "
  608. x = x + "You may drag the form or module to any of the five list boxes." + crlf
  609. x = x + "Now, here is what happens when you select a sub or function in "
  610. x = x + "the listbox on the left that you loaded with the subs and functions "
  611. x = x + "from your selected form or module.  When you do that, the program "
  612. x = x + "loads, into the listbox BELOW it, all of the subs and functions that "
  613. x = x + "the highlighted sub CALLS.  Also, into the listbox ABOVE the one "
  614. x = x + "where you have selected a sub, the program loads all of the subs "
  615. x = x + "or functions that CALL the one you selected.  You will be able to keep "
  616. x = x + "that straight, because the listboxes will be captioned appropriately." + crlf
  617. x = x + "If you click on a sub in a list box, and the list box below stays empty, that means that the sub or function that you highlighted calls no other subs or functions.  "
  618. x = x + "If you click on a sub in a list box, and the list box above stays empty, that means that the sub or function that you highlighted is not called by any other sub or function." + crlf
  619. x = x + "Each listed sub or function is followed by the name of the module or form that "
  620. x = x + "contains it.  You may find that helpful, because you can trace which modules hold the subs that call and are called by the subs you are evaluating, and certainly there are many subs called ''Form_Paint,'' for example, and you will need to know which form's Form_Paint sub is being referenced." + crlf + "If you are about to click on a sub or function in a list "
  621. x = x + "box, and you don't want the list box above or below to change with "
  622. x = x + "your selection, then use the check boxes to the right of the list boxes "
  623. x = x + "to lock the information in that particular list box.  Here's how locking a list box can be useful to you.  Let's say that "
  624. x = x + "the list boxes are numbered 1 through 5, with 1 at the top.  Let's say "
  625. x = x + "that you load a module of subs into listbox 2.  When you click on one "
  626. x = x + "of the subs in listbox 2, listbox 3 now loads with all of the subs that "
  627. x = x + "are called by the sub that you highlighted in listbox 2.  Now, let's say "
  628. x = x + "that the sub you clicked on in listbox 2 calls a sub named mysub(), which "
  629. x = x + "is now listed in listbox 3.  You want to see what different subs mysub() calls.  "
  630. x = x + "However, if you click on mysub, listbox 4 will fill with the subs that "
  631. x = x + "mysub calls, but LISTBOX 2 WILL FILL WITH ALL THE SUBS THAT CALL MYSUB.  "
  632. x = x + "If you don't want to change what is shown in listbox 2, then lock that "
  633. x = x + "listbox before clicking on listbox 3." + crlf
  634. x = x + "If you want to follow a call list of subs deeper, but you are already "
  635. x = x + "in listbox 5, use the menu item that moves the boxes up, and you'll have "
  636. x = x + "more room to follow subs deeper.  You may also move the boxes down if "
  637. x = x + "you bump into the top list box and you still want to find the subs that "
  638. x = x + "call the subs listed in the top list box." + crlf
  639. x = x + "Your program files have to be stored ''as text'' for this to work." + crlf + "The "
  640. x = x + "program only reads files.  It doesn't write to any files on the disk, so "
  641. x = x + "it shouldn't corrupt anything.  No guarantees." + crlf
  642. x = x + "As with LOCALDIM.ZIP, I'm including the source code for those who are curious.  It is not polished code.  If you find a bug, let "
  643. x = x + "me know, and I'll try to fix it.  If you want a feature added, let me "
  644. x = x + "know, and we'll see." + crlf + "There is no error handling in the program.  Your "
  645. x = x + "project should have fewer than 2000 total subs and functions, and "
  646. x = x + "no sub or function should call more than 50 others -- although if you "
  647. x = x + "have bigger needs, just change the dimension parameters of sublist2(), which resides in CALLIST3.BAS." + crlf
  648. x = x + "If these directions are confusing, send me mail or a message, or just play with the program for a while and then "
  649. x = x + "go through and read the instructions again.  They may make more sense the second time!" + crlf + "   --Steve Denenberg  71630,1265"
  650. text1.Text = x
  651. picture1.Left = 0
  652. picture1.Top = 0
  653. picture1.ZOrder
  654. picture1.Visible = True
  655. End Sub
  656. Sub list1_Click (index As Integer)
  657. Dim savedselecteditem As String * 50
  658. Dim currentselection As String * 50
  659. Dim cc As Integer
  660. Dim sublistindex As Integer
  661. Dim dd As Integer
  662. Dim ee As Integer
  663. Dim thesub As Integer
  664. If dontrecurse Then Exit Sub
  665. currentselection = list1(index).List(list1(index).ListIndex)
  666. 'when a listbox entry is selected:
  667. 'deal with the deeper boxes first
  668. 'if it is the deepest list box, don't do anything with the deep stuff
  669. If index = maxlistboxindex Then
  670.     GoTo dealwithsuperficialboxes
  671. End If
  672. '  if the listbox below (deep) to that listbox is not locked, then
  673. If check1(index + 1).Value <> locked Then
  674.     '  if there is a selected entry in the deep listbox,
  675.     '    save it in a variable
  676.     If list1(index + 1).ListIndex <> -1 Then
  677.             savedselecteditem = list1(index + 1).List(list1(index + 1).ListIndex)
  678.         Else
  679.             savedselecteditem = ""
  680.     End If
  681.     '  enter into the deep listbox all of the subs that the selected
  682.     '  sub calls.
  683.     'first, find the sublist index for the selected sub or function
  684.     sublistindex = 0
  685.     Do
  686.     sublistindex = sublistindex + 1
  687.     If sublist2(sublistindex, 0) = currentselection Then
  688.             Exit Do
  689.         ElseIf sublist2(sublistindex, 0) = sublist2(0, 0) Then
  690.             MsgBox "Went through the whole sublist2() array, and couldn't find the selected sub or function.", 48, "Error"
  691.             Exit Sub
  692.     End If
  693.     Loop
  694.     'load the data into the deep listbox
  695.     list1(index + 1).Clear
  696.     cc = 0
  697.     Do
  698.     cc = cc + 1
  699.     If sublist2(sublistindex, cc) <> sublist2(0, 0) Then
  700.             list1(index + 1).AddItem sublist2(sublistindex, cc)
  701.         Else
  702.             Exit Do
  703.     End If
  704.     Loop
  705.     'set thiscallsallofthese() to true for the listbox
  706.     '  where the sub was selected.
  707.     thiscallsallofthese(index) = True
  708. '  if the deep listbox has NOT thiscallsallofthese(), select no item in
  709. '  the deep listbox, and clear all the listboxes deep to the deep listbox
  710. 'jjj this is where we might look deeper down the line for how to handle
  711. '  the other deep ones.
  712. If thiscallsallofthese(index + 1) = False Then
  713.         If index + 2 <= maxlistboxindex Then
  714.             For cc = index + 2 To maxlistboxindex
  715.             list1(cc).Clear
  716.             check1(cc).Value = 0
  717.             Next cc
  718.         End If
  719.     Else
  720. '  if the deep listbox had thiscallsallofthese(), then look for a match
  721. '  between the saved variable and the new entries in the deep listbox.
  722. '  If there is a match, select that item.
  723.         If savedselecteditem <> "" Then
  724.             For cc = 0 To list1(index + 1).ListCount - 1
  725.             If list1(index + 1).List(cc) = savedselecteditem Then
  726.                 dontrecurse = True
  727.                 list1(index + 1).Selected(cc) = True
  728.                 dontrecurse = False
  729.                 GoTo itemselected
  730.             End If
  731.             Next cc
  732.         End If
  733. '  If there is not a match, select no item, and clear all the listboxes
  734. '  deep to the deep listbox
  735.         If index + 2 <= maxlistboxindex Then
  736.             For cc = index + 2 To maxlistboxindex
  737.             list1(cc).Clear
  738.             Next cc
  739.         End If
  740.         GoTo dealwithsuperficialboxes
  741. itemselected:
  742. 'now load the deep^2 box
  743. If index + 2 <= maxlistboxindex Then
  744.     '  enter into the deep listbox all of the subs that the selected
  745.     '  sub calls.
  746.     'first, find the sublist index for the selected sub or function
  747.     sublistindex = 0
  748.     Do
  749.     sublistindex = sublistindex + 1
  750.     If sublist2(sublistindex, 0) = savedselecteditem Then
  751.             Exit Do
  752.         ElseIf sublist2(sublistindex, 0) = sublist2(0, 0) Then
  753.             MsgBox "Went through the whole sublist2() array, and couldn't find the selected sub or function.", 48, "Error"
  754.             Exit Sub
  755.     End If
  756.     Loop
  757.     'load the data into the deep listbox
  758.     list1(index + 2).Clear
  759.     cc = 0
  760.     Do
  761.     cc = cc + 1
  762.     If sublist2(sublistindex, cc) <> sublist2(0, 0) Then
  763.             list1(index + 2).AddItem sublist2(sublistindex, cc)
  764.         Else
  765.             Exit Do
  766.     End If
  767.     Loop
  768.     'set thiscallsallofthese() to true for the listbox
  769.     '  where the sub was selected.
  770.     thiscallsallofthese(index + 1) = True
  771. End If
  772. End If   'If thiscallsallofthese(index + 1) = False
  773. End If   'If check1(index + 1).value <> locked
  774. 'when an item in a listbox is selected, if the box deep to that is locked,
  775. '  then
  776. If check1(index + 1).Value = locked Then
  777. '  if thiscallsallofthese for the selected listbox, give a message that
  778. '  the box below has to be unlocked before a selection can be made in
  779. '  the listbox that was selected.
  780.     If thiscallsallofthese(index) = True Then
  781.         MsgBox "You need to unlock the listbox deep to this before selecting an item in this listbox", 48, "Note"
  782.         GoTo setcheckboxes
  783.     End If
  784. End If
  785. dealwithsuperficialboxes:
  786. 'now deal with the superficial list boxes.
  787. 'if this is the most superficial list box, then just exit
  788. If index = 0 Then GoTo setcheckboxes
  789. '  if there is something highlighted in the superficial listbox, save
  790. '  it in a variable.
  791. If list1(index - 1).ListIndex <> -1 Then
  792.         savedselecteditem = list1(index - 1).List(list1(index - 1).ListIndex)
  793.     Else
  794.         savedselecteditem = ""
  795. End If
  796. '  if the box above is unlocked, then load into it all the subs that call
  797. '  the selected sub,
  798. If check1(index - 1).Value <> locked Then
  799.     list1(index - 1).Clear
  800.     For thesub = 1 To totalnumberofsubs
  801.     cc = 0
  802.     Do
  803.     cc = cc + 1
  804.     If sublist2(thesub, cc) = currentselection Then
  805.             list1(index - 1).AddItem sublist2(thesub, 0)
  806.         ElseIf sublist2(thesub, cc) = sublist2(0, 0) Then
  807.             Exit Do
  808.     End If
  809.     Loop
  810.     Next thesub
  811. 'and set allofthesecallthis for the superficial listbox.
  812.     thiscallsallofthese(index - 1) = False
  813. 'jjj don't process a click if the click is done on the currently-highlighted
  814. '  item.
  815. '  if superficial^2 is thiscallsallofthese, then clear it,
  816. '  unlock it, and clear all list
  817. '  boxes above it.
  818. 'If savedselecteditem<>"", then if savedselecteditem
  819. '  exists in superficial^1, select it, make superficial ^ 2
  820. '  allofthesecallthis, and load superficial^2 appropriately.  If it is not
  821. '  there, do nothing.
  822. '  if superficial^2 is allofthesecallthis, then look for savedselecteditem
  823. '  in superficial.  If it is not there, clear and unlock superficial^2 and
  824. '  everything superficial to it.  If it is there, select it, unlock
  825. '  superficial^2, make it allofthesecallthis, and load superficial^2
  826. '  appropriately.
  827. 'so, we are doing the same thing regardless of the thiscallsallofthese()
  828. '  status of superficial^2
  829.     If index >= 2 Then
  830.             For cc = index - 2 To 0 Step -1
  831.             list1(cc).Clear
  832.             check1(cc).Value = 0
  833.             Next cc
  834.             
  835.             'look for savedselecteditem in superficial
  836.         If savedselecteditem <> "" Then
  837.             For cc = 0 To list1(index - 1).ListCount - 1
  838.             If list1(index - 1).List(cc) = savedselecteditem Then
  839.                 dontrecurse = True
  840.                 list1(index - 1).Selected(cc) = True
  841.                 dontrecurse = False
  842.                 GoTo itemselectedsup
  843.             End If
  844.             Next cc
  845.         End If
  846. '  If there is not a match, select no item, and clear all the listboxes
  847. '  superficial to the superficial listbox
  848.                Call form_paint
  849.         GoTo setcheckboxes
  850. itemselectedsup:
  851.             
  852.         'xxss
  853.         'load superficial^2 with the appropriate stuff
  854.         'jjj is it cleared at this point?
  855.         thiscallsallofthese(index - 2) = False
  856.         For thesub = 1 To totalnumberofsubs
  857.         cc = 0
  858.         Do
  859.         cc = cc + 1
  860.         If sublist2(thesub, cc) = savedselecteditem Then
  861.                 list1(index - 2).AddItem sublist2(thesub, 0)
  862.             ElseIf sublist2(thesub, cc) = sublist2(0, 0) Then
  863.                 Exit Do
  864.         End If
  865.         Loop
  866.         Next thesub
  867.             
  868.             Else
  869.                 Call form_paint
  870.                 GoTo setcheckboxes
  871.         
  872. End If  'if index>=2
  873. End If    'If check1(index - 1).value <> locked
  874. 'when an item in a listbox is selected, if the box superficial to
  875. '  that is locked, then
  876.     If check1(index - 1).Value = locked Then
  877. '  if thiscallsallofthese for the selected listbox, give a message that
  878. '  the box below has to be unlocked before a selection can be made in
  879. '  the listbox that was selected.
  880.         If thiscallsallofthese(index - 1) = False Then
  881.             MsgBox "You need to unlock the listbox superficial to this before selecting an item in this listbox", 48, "Note"
  882.             GoTo setcheckboxes
  883.         End If
  884.     End If
  885. 'xxss
  886. '  if the listbox above that listbox is not locked, then
  887. '  if there is a selected item in the superficial listbox, save it in
  888. '  a variable.
  889. '  load into that
  890. '  listbox all the subs that call the sub that was selected.  set
  891. '  thiscallsallofthese() to false for the superficial listbox.
  892. '  look for a match between the saved item and the new contents of the
  893. '  superficial listbox.  If there is a match and superficial^2 has
  894. '  allofthesecallthis(), then highlight the saved item.  Otherwise, clear
  895. '  superficial^2 and all listboxes superficial to superficial^2.
  896. '  if the deep box is locked and the superficial box is locked, too, give
  897. '  a message that one of them has to be unlocked first.
  898. If index > 0 And index < maxlistboxindex Then
  899.     If check1(index + 1).Value = locked And check1(index - 1).Value = locked Then
  900.         MsgBox "You must unlock one of the list boxes surrounding this one before selecting an item.", 48, "Surrounding list boxes both locked"
  901.     End If
  902. End If
  903. Call form_paint
  904. setcheckboxes:
  905. For cc = 0 To maxlistboxindex
  906. If list1(cc).ListCount = 0 Then
  907.     check1(cc).Value = 0
  908. End If
  909. Next cc
  910. 'when an item is selected in a listbox, if the superficial listbox is
  911. '  locked, then
  912. '  if superficial is thiscallsallofthese, deal with the deep boxes.
  913. '  if superficial is allofthesecallthis, then give a message that
  914. '  selection of this item will redo the superficial box.  Ok to proceed?
  915. '  if ok to proceed, then unlock the box and proceed as if the box were
  916. '  unlocked.
  917. End Sub
  918. Sub list1_DragDrop (index As Integer, Source As Control, x As Single, Y As Single)
  919. Call loadlistbox(index)
  920. End Sub
  921. Sub listmodulenames_MouseDown (button As Integer, Shift As Integer, x As Single, Y As Single)
  922. If button = 1 Then Exit Sub
  923. If button = 2 Then listmodulenames.Drag 1
  924. 'Call listmodulenames_click
  925. End Sub
  926. Sub loadlinesoftext ()
  927. 'load into linesoftext the lines that contain the variable declarations.
  928. Dim nextline As String
  929. Dim inasub As Integer
  930. Dim inafunction As Integer
  931. Dim endoffile As Integer
  932. Dim linesread As Long
  933. Dim sublistindex As Integer
  934. Dim maxlength1 As Integer
  935. Dim nextmodule As String
  936. Dim modulenameindex As Integer
  937. 'modulenameindex starts at 1
  938. modulenameindex = 0
  939. Erase sublist2
  940. 'start subnumber at 1, so that sublist2(0, 0) can be null, to compare
  941. '  against
  942. subnumber = 0
  943. Open filetoopen For Input As #2
  944. Do  'start pulling in the module names
  945. If EOF(2) Then
  946.     Close
  947.     Exit Sub
  948. End If
  949. 'input the next module, called modulename
  950. Line Input #2, nextmodule
  951. nextmodule = Trim$(nextmodule)
  952. 'don't use the module entry if it isn't a .frm or a .bas
  953. If Right$(nextmodule, 3) <> "frm" And Right$(nextmodule, 3) <> "bas" Then
  954.     GoTo skipmakentry
  955. End If
  956. 'modulename() has the .frm and .bas modules, in the order listed in .mak
  957. modulenameindex = modulenameindex + 1
  958. modulename(modulenameindex) = nextmodule
  959. 'prepare to input the module
  960. Open nextmodule For Input As #1
  961. label5.Caption = nextmodule
  962. label5.Refresh
  963. linesread = 0
  964. more:
  965. 'starting a new module, we are neither in a sub nor in a function
  966. inasub = False
  967. inafunction = False
  968. Do   'to input the sub names
  969. If EOF(1) Then
  970.     Close #1
  971.     'gotthefile is the same as skipmakentry.  It says to get the
  972.     '  next module to input
  973.     GoTo gotthefile
  974. End If
  975. nextline = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  976. Line Input #1, nextline
  977. If Len(nextline) > maxlength1 Then maxlength1 = Len(nextline)
  978. linesread = linesread + 1
  979. If linesread Mod 100 = 0 Then
  980.     label1.Caption = Str$(linesread)
  981.     label1.Refresh
  982. End If
  983. nextline = Trim$(nextline)
  984. 'find if we are starting a sub or function
  985. If Left$(nextline, 4) = "sub " Then
  986.         inasub = True
  987.         nextline = Right$(nextline, Len(nextline) - 4)
  988.         GoTo getname
  989.     ElseIf Left(nextline, 9) = "function " Then
  990.         inafunction = True
  991.         nextline = Right$(nextline, Len(nextline) - 9)
  992.         GoTo getname
  993. End If
  994. 'loop and get the next line from the current module if nextline doesn't
  995. '  have the name of a sub or a function
  996. getname:
  997. 'get to here, nextline starts with "sub" or "function"
  998. 'put the name of the sub or function in sublist2(sub#, 0)
  999. Dim thespace As Integer
  1000. thespace = InStr(nextline, " ")
  1001. If thespace = 0 Then
  1002.     MsgBox "sub or function found, but no name can be obtained", 48, "Error"
  1003. End If
  1004. subnumber = subnumber + 1
  1005. totalnumberofsubs = subnumber
  1006. sublist2(subnumber, 0) = Left$(nextline, thespace - 1) + "   " + nextmodule
  1007. 'modulereference(subnumber, 0) = the index of the module name
  1008. modulereference(subnumber, 0) = modulenameindex
  1009. 'now, we have the sub or function.
  1010. '  Input until get to the end of the sub or function
  1011. If EOF(1) Then
  1012.     MsgBox "Trying to find end of sub/function, but ran out of file", 48, "Error"
  1013. End If
  1014. nextline = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  1015. Line Input #1, nextline
  1016. If Len(nextline) > maxlength1 Then maxlength1 = Len(nextline)
  1017. linesread = linesread + 1
  1018. If linesread Mod 100 = 0 Then
  1019.     label1.Caption = Str$(linesread)
  1020.     label1.Refresh
  1021. End If
  1022. 'more means conintue inputting the current module, find the first line
  1023. '  of the next sub or function
  1024. If inasub Then
  1025.         If Left$(nextline, 7) = "End Sub" Then GoTo more
  1026.     ElseIf inafunction Then
  1027.         If Left$(nextline, 12) = "End Function" Then GoTo more
  1028. End If
  1029. gotthefile:
  1030. skipmakentry:
  1031. 'Exit Sub
  1032. 'goterror:
  1033. 'MsgBox Error$(Err) + Str$(Erl)
  1034. 'Exit Sub
  1035. End Sub
  1036. Sub loadlistbox (ByVal index As Integer)
  1037. Dim cc As Integer
  1038. Dim x As String
  1039. For cc = 0 To 4
  1040. list1(cc).Clear
  1041. Next cc
  1042. cc = 0
  1043. cc = cc + 1
  1044. If sublist2(cc, 0) = sublist2(0, 0) Then
  1045.     Call form_paint
  1046.     Exit Sub
  1047. End If
  1048. If modulename(modulereference(cc, 0)) = listmodulenames.List(listmodulenames.ListIndex) Then
  1049.     list1(index).AddItem sublist2(cc, 0)
  1050. End If
  1051. End Sub
  1052. Function min5 (ByVal x As Integer, ByVal Y As Integer, ByVal z As Integer, ByVal a As Integer, ByVal b As Integer)
  1053. 'yields the minimum of the five integers, but if an integer=0, then
  1054. '  it is not reported.
  1055. If x = 0 And Y = 0 And z = 0 And a = 0 And b = 0 Then
  1056.     min5 = 0
  1057.     Exit Function
  1058. End If
  1059. If x = 0 Then x = 9999
  1060. If Y = 0 Then Y = 9999
  1061. If z = 0 Then z = 9999
  1062. If a = 0 Then a = 9999
  1063. If b = 0 Then b = 9999
  1064. If x < Y And x < z And x < a And x < b Then
  1065.     min5 = x
  1066.     Exit Function
  1067. End If
  1068. If Y < x And Y < z And Y < a And Y < b Then
  1069.     min5 = Y
  1070.     Exit Function
  1071. End If
  1072. If z < Y And z < x And z < a And z < b Then
  1073.     min5 = z
  1074.     Exit Function
  1075. End If
  1076. If a < x And a < Y And a < z And a < b Then
  1077.     min5 = a
  1078.     Exit Function
  1079. End If
  1080. If b < x And b < Y And b < z And b < a Then
  1081.     min5 = b
  1082.     Exit Function
  1083. End If
  1084. End Function
  1085. Sub moveboxesdownitem_Click ()
  1086. 'shift the boxes down one
  1087. Dim cc As Integer
  1088. Dim boxindex As Integer
  1089. For boxindex = maxlistboxindex To 1 Step -1
  1090. list1(boxindex).Clear
  1091. dontrecurse2 = True
  1092. check1(boxindex).Value = check1(boxindex - 1).Value
  1093. dontrecurse2 = False
  1094. For cc = 0 To list1(boxindex - 1).ListCount - 1
  1095. list1(boxindex).AddItem list1(boxindex - 1).List(cc)
  1096. Next cc
  1097. If list1(boxindex - 1).ListIndex <> -1 Then
  1098.     dontrecurse = True
  1099.     list1(boxindex).Selected(list1(boxindex - 1).ListIndex) = True
  1100.     dontrecurse = False
  1101. End If
  1102. Next boxindex
  1103. list1(0).Clear
  1104. check1(0).Value = 0
  1105. Call form_paint
  1106. End Sub
  1107. Sub moveboxesupitem_Click ()
  1108. 'shift the boxes up one
  1109. Dim cc As Integer
  1110. Dim boxindex As Integer
  1111. For boxindex = 0 To maxlistboxindex - 1
  1112. list1(boxindex).Clear
  1113. dontrecurse2 = True
  1114. check1(boxindex).Value = check1(boxindex + 1).Value
  1115. dontrecurse2 = False
  1116. For cc = 0 To list1(boxindex + 1).ListCount - 1
  1117. list1(boxindex).AddItem list1(boxindex + 1).List(cc)
  1118. Next cc
  1119. If list1(boxindex + 1).ListIndex <> -1 Then
  1120.     dontrecurse = True
  1121.     list1(boxindex).Selected(list1(boxindex + 1).ListIndex) = True
  1122.     dontrecurse = False
  1123. End If
  1124. Next boxindex
  1125. list1(maxlistboxindex).Clear
  1126. check1(maxlistboxindex).Value = 0
  1127. Call form_paint
  1128. End Sub
  1129. Sub openfileitem_Click ()
  1130. On Error GoTo goterror
  1131. Close
  1132. Dim cc
  1133. cmdialog1.InitDir = "c:\"
  1134. cmdialog1.Filter = "Project files (*.MAK)|*.mak"
  1135. cmdialog1.Action = 1
  1136. filetoopen = cmdialog1.Filename
  1137. On Error GoTo 0
  1138. Caption = "Sub Finder  --  ''" + filetoopen
  1139. listmodulenames.Clear
  1140. Erase modulereference
  1141. Erase sublist2
  1142. Erase modulename
  1143. For cc = 0 To maxlistboxindex
  1144. list1(cc).Clear
  1145. Next cc
  1146. loadlinesoftext
  1147. findallsubreferences
  1148. Exit Sub
  1149. goterror:
  1150. Exit Sub
  1151. End Sub
  1152. Function stripparentheses (theline As String)
  1153. Dim beginparenthesis As Integer
  1154. Dim endparenthesis As Integer
  1155. Dim beginp As String
  1156. Dim endp As String
  1157. Dim startlooking As Integer
  1158. beginp = "("
  1159. endp = ")"
  1160. beginparenthesis = InStr(theline, beginp)
  1161. If beginparenthesis = 0 Then
  1162.     stripparentheses = theline
  1163.     Exit Function
  1164. End If
  1165. endparenthesis = InStr(beginparenthesis + 1, theline, endp)
  1166. If endparenthesis = 0 Then
  1167.     stripparentheses = theline
  1168.     Exit Function
  1169. End If
  1170. theline = Left$(theline, beginparenthesis - 1) + " " + Right$(theline, Len(theline) - endparenthesis)
  1171. End Function
  1172. Function stripquotes (theline As String)
  1173. Dim beginquote As Integer
  1174. Dim endquote As Integer
  1175. beginquote = InStr(theline, doublequote)
  1176. If beginquote = 0 Then
  1177.     stripquotes = theline
  1178.     Exit Function
  1179. End If
  1180. endquote = InStr(beginquote + 1, theline, doublequote)
  1181. If endquote = 0 Then
  1182.     stripquotes = theline
  1183.     Exit Function
  1184. End If
  1185. theline = Left$(theline, beginquote - 1) + " " + Right$(theline, Len(theline) - endquote)
  1186. End Function
  1187.